#include "HiranipraShared.h"

#include "Net/Packet.h"

#ifndef _SHARED_NET_PEER_H_
#define _SHARED_NET_PEER_H_

namespace Hiranipra {
	namespace Net {

		enum PeerState
		{
			PeerConnected,
			PeerDisconnecting,
			PeerDisconnected
		};

		class Peer : implements RefInstance
		{
		public:
			Peer( ENetPeer* sourcePeer ) :
				_peer( sourcePeer ), _state( PeerConnected )
			{
			}

			bool IsConnected() const { return _state == PeerConnected; }
			PeerState GetState() const { return _state; }

			bool Send( uint8 channelId, Packet* packet );
			void Disconnect( bool flushPending, uint32 data );

		private:
			ENetPeer*	_peer;
			PeerState	_state;
		};

	}
}

#endif // _SHARED_NET_PEER_H_
